package com.far.permissions.support;

import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.ParameterMapping;
import org.apache.ibatis.session.Configuration;

import java.util.List;

public class BuilderBoundSql extends BoundSql {
    public BuilderBoundSql(Configuration configuration, String sql, List<ParameterMapping> parameterMappings, Object parameterObject) {
        super(configuration, sql, parameterMappings, parameterObject);
    }

    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {
        private Configuration configuration;
        private String sql;
        private List<ParameterMapping> parameterMappings;
        private Object parameterObject;

        public Builder configuration(Configuration configuration) {
            this.configuration = configuration;
            return this;
        }

        public Builder sql(String sql) {
            this.sql = sql;
            return this;
        }

        public Builder parameterMappings(List<ParameterMapping> parameterMappings) {
            this.parameterMappings = parameterMappings;
            return this;
        }

        public Builder parameterObject(Object parameterObject) {
            this.parameterObject = parameterObject;
            return this;
        }

        public BuilderBoundSql build() {
            return new BuilderBoundSql(this.configuration, this.sql, this.parameterMappings, this.parameterObject);
        }
    }
}
